/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import pojo.DichVuPoJo;
import util.DataProvider;

/**
 *
 * @author Kanet
 */
public class DichVuDao {
        public static ArrayList<DichVuPoJo> laydanhsachDichVu()
    {
        ArrayList<DichVuPoJo> arr = new ArrayList<DichVuPoJo>();
        String sql = "SELECT * FROM dichvu";
        DataProvider dp = new DataProvider();
        dp.open();
        
        try{
            ResultSet rs = dp.executeQuery(sql);
            while (rs.next()){
               DichVuPoJo dv = new DichVuPoJo();
                dv.setIdDichVu(rs.getInt("idDichVu"));
                dv.setTenDV(rs.getString("tenDichVu"));
                arr.add(dv);
            }            
        }
        catch(SQLException ex){
            System.out.println(ex.getMessage());                        
        }
        dp.close();
        return arr;
    }
}
